package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-05
 * Time: 17:28
 */


//实现一个动物类
class Animal{
    public String name = "花花";//名字
    public int age;//年龄
    public String furColor;//毛颜色
    public void eat() {
        System.out.println(this.name+"吃饭！！！");
    }
    public void sleep() {
        System.out.println(this.name+"睡觉！！！");
    }
    public void method() {
        System.out.println("我是父类的方法！！！");
    }

    public Animal(String name, int age, String furColor) {
        this.name = name;
        this.age = age;
        this.furColor = furColor;
    }
}
//实现一个猫类
class Cat extends Animal {
    public String name = "咪咪";

    public Cat(String name, int age, String furColor, String name1) {
        super(name, age, furColor);
        this.name = name1;
    }

    public void mew() {
        System.out.println(this.name + "喵喵喵");
    }
    public void method() {
        System.out.println("我是子类的方法");
    }
    public void methodA() {
        super.method();
    }
}
public class TestDemo1 {
    public static void main(String[] args) {
       Cat cat =new Cat();
       cat.methodA();
    }
}
